<%-- 
    Document   : AddTest
    Created on : 24/04/2011, 05:20:24 PM
    Author     : Jhon
--%>

<%@page import="vo.VOTestcase"%>
<%@page import="control.Controller"%>
<%@page import="vo.VOProblem"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String pcode =  request.getParameter("pcode");
    String input =  request.getParameter("input");
    String output=  request.getParameter("output");
    if(pcode ==null || pcode=="" || input==null || input =="" || output==null || output==""){
    response.sendRedirect("../Problemas/CreateTest.jsp");
    return;
    }
    Controller con = Controller.getInstance();
    VOTestcase t = new VOTestcase();
    t.setProblemCode(pcode);
    t.setInput(input);
    t.setOutput(output);

    try{
        con.createTestcase(t);
    }catch(Exception e){
        session.setAttribute("ERROR", e.getMessage());
        response.sendRedirect("../Error/Error.jsp");
        return;
    }
    response.sendRedirect("../Problemas/BuscarProblema.jsp");
    %>